package A003volatile;

public class A006_volatile指令重排案例2 {
    int a = 0;
    boolean flag = false;

    public void method01() {
        a = 1;//语句1
        flag = true;//语句2
    }

    public void method02() {
        if (flag) {
            a = a + 5; //语句3
        }
        System.out.println("retValue: " + a);//可能是6或1或5或0
    }
}
